﻿using PComponent.utility.sharedprop;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SharedPropTest2
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        TestClass1 tclass1;
        TestClass2 tclass2;

        public MainWindow()
        {
            InitializeComponent();

            this.Loaded += MainWindow_Loaded;
        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //AppViewModel.Service.TestNumber=0; already init in App.xaml

            tclass1 = new TestClass1();
            tclass2 = new TestClass2();

            UiTClass1.DataContext = tclass1;
            UiTClass2.DataContext = tclass2;
        }

        private void UiChangeValueBt_Click(object sender, RoutedEventArgs e)
        {
            var val =int.Parse( UiInputValueTb.Text);
            tclass1.TestNumber.value = val; //Look here I change the value of one prop in one object
        }
    }
}
